const strapiBaseUri = process.env.API_URL || "http://localhost:1337";

// 编译成静态网站时用 "http://www.jike-vision.com" 上传服务器可以正常显示图片
// const jikeid = "http://localhost:1337";
const jikeid = process.env.baseUrl;
// const jikeid = "http://www.jike-vision.com";

export default {
  target: "static",
  env: {
    strapiBaseUri,
    jikeid,
  },
  // 加快编译速度
  loaders: {
    prettify: false,
  },
  head: {
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
    ],
    link: [
      // {
      //   rel: "stylesheet",
      //   href: "https://fonts.googleapis.com/css?family=Staatliches",
      // },
    ],
    script: [
      {
        // src: "https://api.map.baidu.com/api?v=2.0&ak=qUr9LQHZPs2YWRGdoO9uWvhy2FSlErqn",
      },
    ],
  },
  /*
   ** Global CSS
   */
  css: [
    "uikit/dist/css/uikit.min.css",
    "uikit/dist/css/uikit.css",
    "element-ui/lib/theme-chalk/index.css",
    "animate.css/animate.css",
    // "swiper/swiper.css",
    "@assets/css/main.css",
    "video.js/dist/video-js.css",
  ],
  plugins: [
    "@/plugins/element-ui",
    // { src: "~/plugins/swiper.js", ssr: false },
    { src: "~/plugins/uikit.js", ssr: false },
    { src: "@/plugins/vue-seamless-scroll", ssr: false },
    { src: "@/plugins/videoPlayer.js", ssr: false },
  ],
  modules: ["@nuxtjs/markdownit", "@nuxtjs/strapi"],
  strapi: {
    url: strapiBaseUri,
    entities: [
      {
        name: "articles",
        type: "collection",
      },
      {
        name: "photos",
        type: "collection",
      },
      {
        name: "Mynews",
        type: "collection",
      },
      {
        name: "categoryphotos",
        type: "collection",
      },
      {
        name: "categories",
        type: "collection",
      },
      {
        name: "homepage",
        type: "single",
      },
      {
        name: "global",
        type: "single",
      },
    ],
  },
  markdownit: {
    preset: "default",
    linkify: true,
    breaks: true,
    injected: true,
    html: true,
  },
  build: {
    transpile: [/^element-ui/],
  },
};
